package com.rrd.hive.udf;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.io.Text;

import com.rrd.hive.util.AESUtil;


public class MobileAES extends UDF{
//	private static final char[] dictionary = "9876543210".toCharArray();
	private static final char[] dictionary = "6789541230".toCharArray();
	public Text evaluate(String mobile) {
		Text text = new Text("");
		 
		try {
			text.set(AESUtil.decryptPhone(mobile));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			 
		}
		return text;
	}
	

public static void main(String[] args) {
	TimeZone tz = TimeZone.getTimeZone("Asia/Shanghai");
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");  
    df.setTimeZone(tz);  
    Date date = new Date();
    String nowAsISO = df.format(date);  
    System.out.println(nowAsISO);
}
   
}
